package edu.sdcet.mybatisdemo.controller;

import edu.sdcet.mybatisdemo.entity.Student;
import edu.sdcet.mybatisdemo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StudentController {
    @Autowired
    private StudentService studentService;

    @GetMapping(value = "/getStudentById/{student_id}", produces = "application/json")
    public Student getStudentById(@PathVariable("student_id") String StudentId){
        System.out.println("student_id="+StudentId);
        Student student = studentService.getStudentById(StudentId);
        System.out.println("student="+student);
        return student;
    }
}
